package com.service.impl;

import com.domain.User;
import com.mapper.IUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.service.IUserService;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: wu linchun
 * @time: 2021/4/4 21:21
 */
@Service
public class UserServiceImpl implements IUserService {
    IUserMapper iUserMapper;

    public UserServiceImpl() {
    }

    @Autowired
    public UserServiceImpl(IUserMapper iUserMapper) {
        this.iUserMapper = iUserMapper;
    }

    @Override
    public List<User> allUser() {
        List<User> userList=new ArrayList<User>();
        userList=iUserMapper.allUser();
        return userList;
    }

    @Override
    public User queryUserbyUserName(String username) {
        User user=iUserMapper.queryUserbyUserName(username);
        return user;
    }

    @Override
    public int addUser(User user) {
        return iUserMapper.addUser(user);
    }

    @Override
    public int deleteUserById(int id) {
        return iUserMapper.deleteUserById(id);
    }

    @Override
    public int updateUser(User user) {
        return iUserMapper.updateUser(user);
    }
}
